package com.masterclient.app.businessmodule.minemodule.redpack.adapter;

import android.view.View;
import android.widget.LinearLayout;
import android.widget.TextView;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.masterclient.app.R;
import com.masterclient.app.modules.coupon.beans.RedPackedListBean;
import com.eoner.baselibrary.utils.Utils;

import butterknife.BindView;

/**
 * 作者：sean
 * 创建时间：2017/8/7 14:08
 * 功能说明：
 */

public class RedPackedPayForAdapter extends BaseQuickAdapter<RedPackedListBean.DataBean.ShItemsBean, BaseViewHolder> {


    @BindView(R.id.tv_title)
    TextView tvTitle;
    @BindView(R.id.tv_order_no)
    TextView tvOrderNo;
    @BindView(R.id.tv_time)
    TextView tvTime;
    @BindView(R.id.ll_order)
    LinearLayout llOrder;
    @BindView(R.id.tv_price_num)
    TextView tvPriceNum;

    public RedPackedPayForAdapter() {
        super(R.layout.item_red_packed_payfor);
    }

    @Override
    protected void convert(BaseViewHolder helper, RedPackedListBean.DataBean.ShItemsBean item) {
        helper.setText(R.id.tv_time, item.getSh_create_at());
        helper.setText(R.id.tv_title, item.getSh_type_reason());

        helper.setText(R.id.tv_price_num, "-" + item.getSh_amount());
        Utils.setDin(helper.getView(R.id.tv_price_num),mContext);
//        if(TextUtils.isEmpty(item.getSh_detail_no())){
//            helper.getView(R.id.tv_order_no).setVisibility(View.INVISIBLE);
//        }else{
//            helper.getView(R.id.tv_order_no).setVisibility(View.VISIBLE);
//            helper.setText(R.id.tv_order_no,"交易编号："+item.getSh_detail_no());
//        }
        if(helper.getLayoutPosition() == getData().size()-1){
            helper.getView(R.id.v_line).setVisibility(View.INVISIBLE);
        }
    }
}
